{% extends "base.html" %}


{% block headtitle %}Admin: Trip Spots{% endblock %}
{% block pagetitle %}Admin: Trip Spots{% endblock %}

{% block content %}

Enter the trip you would like to view:
<form method="POST" action="">
<label>Year:</label>
<select name="year">
  {% for y in years %}
  <option {% ifequal y year %}selected{% endifequal %}>{{ y }}</option>
  {% endfor %}
</select>
<label>Trip Number:</label>
<select name="trip_number">
  {% for t in trip_nums %}
  <option {% ifequal t trip_number %}selected{% endifequal %}>{{ t }}</option>
  {% endfor %}
</select>
<button type="submit">Go</button>
</form>

{% if trip_spots %}
Total signed up: {{ trip_spots|length }}
<table class="triplist">
  <tr>
    <th>&nbsp;</th>
    <th>id</th>
    <th>Date</th>
    <th>Room #</th>
    <th>Paid?</th>
    <th>Waiver?</th>
    <th>Order ID</th>
    <th>Info ID</th>
    <th>Name</th>
    <th>Email</th>
    <th>Status</th>
    <th>Pickup</th>
    <th>Roommate Req.</th>
    <th>Vege</th>
  </tr>
  {% for trip_spot in trip_spots %}
  <tr>
    <td><a href="{% url admin_tripspot_view trip_spot.key.id  %}">View</a> | <a href="{% url admin_tripspot_update trip_spot.key.id  %}">Edit</a></td>
    <td>{{ trip_spot.key.id }}</td>
    <td>{{ trip_spot.date_created }}</td>
    <td>{{ trip_spot.room }}</td>
    <td>{{ trip_spot.is_paid }}</td>
    <td>{{ trip_spot.is_waiver }}</td>

    {% if trip_spot.trip_order %}
    <td>{{ trip_spot.trip_order.key.id }}</td>
    {% else %}
    <td>?</td>
    {% endif %}

    {% if trip_spot.trip_signup_info %}
    <td>{{ trip_spot.trip_signup_info.key.id }}</td>
    <td>{{ trip_spot.trip_signup_info.first_name }} {{ trip_spot.trip_signup_info.last_name }}</td>
    <td>{{ trip_spot.trip_signup_info.email }}</td>
    <td>{{ trip_spot.trip_signup_info.membership }}</td>
    <td>{{ trip_spot.trip_signup_info.pickup }}</td>
    <td>{{ trip_spot.trip_signup_info.roommate }}</td>
    <td>{{ trip_spot.trip_signup_info.is_vege|default:"-" }}</td>
    {% else %}
    <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td>
    {% endif %}
  </tr>
  {% endfor %}
</table>

<a href="{% url admin_trip_roster_download year=year, trip_number=trip_number %}">Download CSV Roster</a>
{% endif %}

{% endblock %}
